﻿using Basic.UserCollect;
using Basic.UserModel.WxUser;
using WeDonekRpc.Client.Interface;

namespace Basic.UserLocalEvent.WxLogin
{
    internal class WxBindEvent : IEventHandler<WxUserBindEvent>
    {
        private readonly IWxUserCollect _Service;

        public WxBindEvent (IWxUserCollect service)
        {
            this._Service = service;
        }

        public void HandleEvent (WxUserBindEvent data, string eventName)
        {
            WxUserDto user = this._Service.GetUser(data.WxUserId);
            this._Service.Bind(user, data.UserId);
        }
    }
}
